Resource
Interchange File Format Services
The preferred
format for multimedia files is resource interchange file format (RIFF). The
RIFF file I/O functions work with the basic buffered and unbuffered file I/O
services. You can open, read, and write RIFF files in the same way as other
file types. For detailed information about RIFF, see AVIFile Functions and
Macros
RIFF files
use four-character codes to identify file elements. These codes are 32-bit
quantities representing a sequence of one to four ASCII alphanumeric
characters, padded on the right with space characters. The data type for
four-character codes is FOURCC. Use the mmioFOURCC
The basic
building block of a RIFF file is a chunk. A chunk is a logical unit of
multimedia data, such as a single frame in a video clip. Each chunk contains
the following fields:
A four-character code
specifying the chunk identifier
A doubleword value specifying
the size of the data member in the chunk
A data field
The following
illustration shows a RIFF chunk that contains two subchunks.
{bmc bm95.BMP}
A chunk
contained in another chunk is a subchunk. The only chunks allowed to
contain subchunks are those with a chunk identifier of RIFF or LIST . A
chunk that contains another chunk is called a parent chunk. The first
chunk in a RIFF file must be a RIFF chunk. All other chunks in the file are
subchunks of the RIFF chunk.
RIFF chunks
include an additional field in the first four bytes of the data field. This
additional field provides the form type of the field. The form type is a
four-character code identifying the format of the data stored in the file. For
example, Microsoft waveform-audio files have a form type of WAVE .
LIST chunks
also include an additional field in the first four bytes of the data field.
This additional field contains the list type of the field. The list type
is a four-character code identifying the contents of the list. For example, a
LIST chunk with a list type of INFO can contain ICOP and ICRD chunks
providing copyright and creation date information. The following illustration
shows a RIFF chunk that contains a LIST chunk and one other subchunk (the
LIST chunk contains two subchunks).
{bmc bm96.BMP}
Multimedia
file I/O services include two functions you can use to navigate among chunks in
a RIFF file: mmioAscend
To create a
new chunk, use the mmioCreateChunk